/**
 * @(#)SeachDataController.java 2017年6月2日
 * Copyright(C) 2017年6月2日 ZHEXIN IT CO.,LTD. All rights reserved.
 */
package org.jsbd.boss.action;


import java.util.Map;

import javax.annotation.Resource;

import org.apache.commons.lang.StringUtils;
import org.jsbd.boss.common.DataGridModel;
import org.jsbd.boss.domian.statistics.TaskReturnStatistics;
import org.jsbd.boss.service.ITaskReturnService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 任务回传查询
 * @author <a href="mailto:wangjunbiao@zhexinit.com" >王俊标</a>
 * @version 1.0.0
 */
@Controller
@RequestMapping("/taskReturn")
public class TaskReturnController {
	public static final Logger LOGGER = LoggerFactory.getLogger(TaskReturnController.class);

	@Resource
	private ITaskReturnService taskReturnService;
	
	@RequestMapping(value = "/list")
	public String list (Model model) throws Exception {
		return "/taskReturn/taskReturn";
	}
	
	@ResponseBody
	@RequestMapping("/listJson")
	public Map<String,Object> listJson(DataGridModel page, TaskReturnStatistics taskReturnStatistics) throws Exception {
		String startTime = taskReturnStatistics.getStartTime();
		String endTime = taskReturnStatistics.getEndTime();
		if (StringUtils.isNotBlank(startTime) || StringUtils.isNotBlank(endTime)) {
			taskReturnStatistics.setStartTime(startTime.replaceAll("-", ""));
			taskReturnStatistics.setEndTime(endTime.replaceAll("-", ""));
		} 
		
		return taskReturnService.getTaskReturnPageList(page, taskReturnStatistics);
	}
	
}
